/**CopyRight[1990-2012]<lyc2877@gmail.com>
 */
#ifndef MYIPCS_INCLUDE_COMMON_H_
#define MYIPCS_INCLUDE_COMMON_H_

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <errno.h>
#include <pthread.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/signal.h>
#include <sys/file.h>
#include <set>
using namespace std;

#define COMMON_KEY 10000
#define THREAD_NAME_LEN 50
#define PERM S_IRUSR|S_IWUSR
#define MQKEY_PROCESS   10
#define MQKEY_WORKER    5 
#define MQKEY_SENDER    6 
#define LOCK_FILE "./.lock"
#define LOCK_FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH

enum
{
  LOCK_WAIT   = LOCK_EX,
  LOCK_NOWAIT = LOCK_EX | LOCK_NB,
  UNLOCK      = LOCK_UN
};

typedef struct _stMsg {
  int64_t m_lTo;
  unsigned char m_ucState;
  char    m_szBuf[128];
}TMsg;

enum {
  WORK  = 0x00,
  STOP  = 0x01
};

#define WORKER_SERVER   100
#define WORKER_CLIENT   101

#endif  // MYIPCS_INCLUDE_COMMON_H_
